[flake8-pyi
] Rename PYI019
and improve its diagnostic message
#15885
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Currently the name of
PYI019
iscustom-type-var-return-type
and its diagnostic message is:There are two issues that this PR addresses:
Self
rather than a customTypeVar
, you'll need to change other annotations in the method's non-self parameters, not just theself
annotation and the return annotation. Indeed, our preview-mode autofix for stub files will change some of these annotations. But the message and name imply that the rule is just about the return annotation.I think the changes here should all be backwards-compatible, but we'll need to remember to add a redirect for the documentation after the next release (whether it is a minor release or patch release). In my opinion, the diagnostic's range should also cover the whole of the function's header, but this would be backwards-incompatible, so I'll propose it separately (it will either need to be preview-only or wait until the next minor release).
Test Plan
cargo test -p ruff_linter --lib